#ifndef _WEAPON_
#define _WEAPON_

#include "hge\hgeresource.h"

class IFCS;

/**
 * @brief basic class for all weapon
 */
class Weapon
{
public:
	/**
	 * @brief before add to IFCS, all pointers below must be NULL
	 */
	Weapon(): ifcs(0), next(0), prev(0), cLife(0.f), tLife(0), hgeResMan(0) {}
	Weapon(hgeResourceManager* _hgeResMan, float _life, int _playerId)
		: hgeResMan(_hgeResMan), ifcs(0), next(0), prev(0), cLife(_life), tLife(_life), playerId(_playerId) {} 
	virtual ~Weapon() {}
	/**
	 * @updated each frame.
	 *
	 * @param dt time passed since last called
	 *
	 * @return whether the weapon is about to be destroyed.
	 */
	virtual bool update(float dt) { cLife -= dt; if (cLife <= 0.f) return true; return false; }
	virtual void render() {}
	/**
	 * @brief weapon fire control system
	 */
	IFCS* ifcs;
	/**
	 * @brief making up a weapon link
	 */
	Weapon *next, *prev;
	int playerId;
protected:
	float cLife, tLife;
	hgeResourceManager* hgeResMan;
};

#endif 